package com.zj.controller;

import com.zj.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {

    @Autowired
    private HelloService service;

    @GetMapping("/")
    public String home() {
        return "forward:/index.jsp"; // 或者 "index" 如果你已经在Spring MVC中配置了解析器来查找JSP等视图
    }

    @ResponseBody
    @RequestMapping("hello")
    public String hello(){
        return service.say("hello mvc");
    }

    @RequestMapping("success")
    public String success(){
        return "success";
    }
}
